import { Address } from 'src/address/entities/address.entity';
import { Order } from 'src/order/entities/order.entity';
import {
  Entity,
  Column,
  PrimaryGeneratedColumn,
  BaseEntity,
  OneToOne,
  OneToMany,
} from 'typeorm';

@Entity()
export class User extends BaseEntity {
  @PrimaryGeneratedColumn()
  id: number;
  @Column()
  name: string;
  @Column({ unique: true })
  username: string;
  @Column()
  password: string;
  @Column()
  avatar: string;
  @Column()
  phone: string;
  @Column()
  isShow: boolean;
  @Column()
  create_time: Date;
  @Column()
  update_time: Date;
  @Column({ nullable: true })
  delete_time: Date;

  @OneToMany(() => Order, (order) => order.user)
  order: Order[];

  @OneToMany(() => Address, (address) => address.user)
  address: Address[];
}
